;
(function() {
	module.exports = {
		prefix: "/bus/assshop",
		get: {
			"/list": function() {
				var bus = role.getBus(this);
				this.body = ResponObj("json", bus.getAssshopList());
			},
			"/list/:bus_id": function() {
				var bus = BusCon.get(this.params.bus_id);
				if (!bus) {
					throwCusError("找不到指定商家");
				}
				this.body = ResponObj("json", bus.getAssshopList());
			},
			"/require_list": function() {
				var bus = role.getBus(this);
				this.body = ResponObj("json", bus.getRequireAssshopList());
			}
		},
		post: {
			"/require_vcode": function() {
				var bus = role.getBus(this);
				var body = this.request.body;
				if (!body.phone) {
					throwCusError("参数错误")
				}
				bus.requireAssshop(body.phone);
				this.body = ResponObj("string", "已经提交联合申请");
			},
			"/add_assshop": function() {
				var bus = role.getBus(this);
				var body = this.request.body;
				if (!body.vcode) {
					throwCusError("参数错误")
				}
				bus.addAssshop(body.vcode);
				this.body = ResponObj("json", bus.getAssshopList());
			}
		},
		delete: {
			"/remove_assshop/:bus_id": function() {
				var bus = role.getBus(this);
				var bus_id = this.params.bus_id;
				bus.removeAssshop(bus_id);
				this.body = ResponObj("json", bus.getAssshopList());
			}
		}
	}
	var role = require("./role");
	var BusCon = require("../../core/bus/_con");
	var UserCon = require("../../core/user/_con");
	var GoodsCon = require("../../core/goods/_con");
	var AchCon = require("../../core/ach/_con");
	var db = require("../../core/db/index");
	var config = require("../../core/_include/config");
	var ResponObj = require("../_include/responObj");
}());